package com.wolfsea.binderdemo
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.viewbinding.ViewBinding

abstract class BaseFragment<VB:ViewBinding>(val block: (LayoutInflater, ViewGroup?, Boolean) -> VB) : Fragment() {

    private lateinit var _binding: VB

    protected val mBinding get() = _binding

    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        _binding = block(layoutInflater, container, false)
        return _binding.root
    }
}